<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>
			阳光成单系统
		</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="./css/x-admin.css" media="all">
		

		<link rel="stylesheet" type="text/css" href="js/bootstarp-3.3.7/css/bootstrap.min.css"/>
		<script src="vendor/jquery/jquery-3.2.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="js/bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="js/bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
			$(function() {


				$("#hname").attr('disabled', "true");
				$("#hosname").attr('disabled', "true");
				$("#countdoctor").attr('disabled', "true");
				$("#departmentname").attr('disabled', "true");
				

				//科室
				$.ajax({
					type: "get",
					url: "http://127.0.0.1:8099/getdname",
					success: function(data) {
						var ks = "";
						for(var i = 0; i < data.length; i++) {
							if(i > 0)
								ks += "   ";
							ks += data[i].departmentName;
						}
						$("#departmentname").val(ks);
					}
				});

				//医生数量
				$.ajax({
					type: "get",
					url: "http://127.0.0.1:8099/getcountDoctor",
					success: function(data) {
						$("#countdoctor").val(data);
					}
				});

				//姓名--诊所名称
				$.getJSON("http://127.0.0.1:8099/getHispital", function(data) {
				
					
					$("#id").val(data.id); 
					$("#hname").val(data.owner_name);
					$("#hosname").val(data.hospital_name);
					$("#major").val(data.major_field);
					$("#address").val(data.address);
					$("#introduction").val(data.introduction);
				})
				
				
				//修改
				$("#bianji").click(function() {
					var  name= $("#bianji").val();
					if (name == '编辑') { //可编辑事件
						$("#bianji").val('保存');
						
						$("#address").attr("style","background-color: white;border: 1px;")
						$("#majorfield").attr("style","background-color: white;border: 1px;")
						$("#introduction").attr("style","background-color: white;border: 1px;")
						
							$.ajax({
							type:"post",
							url:"http://127.0.0.1:8099/updateHis",
							data:$("#cfrom").serialize(),
							dataType:"json",
							success:function (data) {
								document.href("hospitalxiaoxi.html");
						}
					});
						
					} else {  //保存事件
						$("#bianji").val("编辑")
//						$.ajax({
//							type:"post",
//							url:"http://127.0.0.1:8099/updateHis",
//							data:$("#cfrom").serialize(),
//							dataType:"json",
//							success:function (data) {
//								document.href("hospitalxiaoxi.html");
//						}
//					});
						}
			
			

					})
				

			})




			function chaid(id) {

				$.ajax({
					type: "get",
					url: "http://127.0.0.1:8099/selectid" + id,
					data:$("#cfrom").serialize(),
					dataType: "json",
					success: function(data) {
						$("#id").val(data.id);
						$("#majorfield").val(data.major_field)
						$("#address").val(data.address)
						$("#introduction").val(data.introduction)

					}
				});
				

			}
			

			function xiugaiHis() {
				$.ajax({
					type:"post",
					url:"http://127.0.0.1:8099/updateHis",
					data:$("#cfrom").serialize(),
					dataType:"json",
					success:function (data) {
						document.href("hospitalxiaoxi.html");
					}
				});
	
			}

			
			
		</script>

	</head>

	<body id="shuaxinbo">
		<div class="x-nav">
			<span class="layui-breadcrumb">                                                                                                   
              <a><cite>我的桌面</cite></a>                                                                                                        
              <a><cite>系统设置</cite></a>                                                                                                        
              <a><cite>诊所信息</cite></a>             
              
            </span>

		</div>
		<div class="xbody">
			<form id="cfrom">
				<xblock>

					<table width="100%" id="xtab">

						<!--id-->
						<input type="hidden" name="id" id="id" value="" />

						<tr>
							<td style="font-size:16px; color: #1E9FFF;font: '微软雅黑';" width="80px">所有者信息</td>
							<td align="left" style="font-size:13px;">（诊所最高负责人为所有者）</td>
							<td align="right"><input type="button" class="btn btn-primary" id="bianji" value="编辑"></td>
						</tr>
						<tr>
							<td width="85px">所有者姓名：</td>
							<td align="left" id="td1"><input style="border-style:none" type="text" id="hname" /></td>
						</tr>
						<tr>
							<td width="85px" align="right">职务：</td>
							<td align="left">院长</td>
						</tr>
					</table>
				</xblock>

				<xblock>
					<table width="100%" id="zsxingxi">
						<tr>
							<td style="font-size:16px; color: #1E9FFF;font: '微软雅-3;黑';" width="80px">诊所的信息</td>
							<td align="left" style="font-size:13px;">（关于诊所的基本信息及最大成员数量）</td>
						</tr>

						<tr>
							<td width="85px">医生数量：</td>
							<td align="left" id="td1"><input style="border-style:none" type="text" id="countdoctor" /></td>
						</tr>
						<tr>
							<td width="85px">诊所科室：</td>
							<td align="left" id="td1"><input style="border-style:none" type="text" id="departmentname" /></td>
						</tr>

						<div>
							
							<tr>
							<td width="85px">专业方向：</td>
							<td align="left" >
								<input type="text" id="major" name="major" value="" />
							</td>
						</tr>
						<tr>
							<td width="85px">诊所地址：</td>
							<td align="left">
								<input type="text" id="address" name="address" value="" />
							</td>
						</tr>
						<tr>
							<td width="85px">诊所简介：</td>
							<td align="left" >
								<textarea name="introduction"  id="introduction"></textarea>

							</td>
							
						</tr>
							
						</div>
					

					</table>

				</xblock>

			</form>

		</div>
		<script src="assets/layui-v2.4.5/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="assets/layui-v2.4.5/layui/css/layui.css" />
		<!--<script>
			layui.use(['element', 'laypage', 'layer', 'form'], function() {
				$ = layui.jquery; //jquery                                                                                                     
				lement = layui.element(); //面包导航                                                                                                 
				laypage = layui.laypage; //分页                                                                                                    
				layer = layui.layer; //弹出层                                                                                                       
				form = layui.form(); //弹出层                                                                                                       
			})
		</script>-->

		<style type="text/css">
			#td1{
				background-color: #F2F2F2;
				height: 30px;
			}
			
			#departmentname {
				
				width: 600px;
			}
			
			#introduction{
				width:550px;
            	border: 0px;
            	background-color: #F2F2F2;
            	}
            	
            #address{
            	width: 200px;
            	border: 0px;
            	background-color: #F2F2F2;

            }
            
            #major{
            	width: 200px;
            	border: 0px;
            	background-color: #F2F2F2;

            }
            

      
            
         
		</style>

	</body>

</html>